      INTEGER FUNCTION LENOCC(CH)
      CHARACTER*(*) CH
      L = LEN(CH)
      DO 1 I=L,1,-1
        IF(CH(I:I).NE.' ') THEN
          LENOCC = I
          RETURN
        ENDIF
    1 CONTINUE
      LENOCC = 0
      END
